﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AirLinq.Providers.Sql {
	public class SqlComparision : SqlPredicate{
		private readonly SqlExpression _left;
		private readonly SqlExpression _right;
		private readonly SqlNodeType _nodeType;
		public SqlComparision(SqlExpression left, SqlNodeType nodeType, SqlExpression right) {
			if (left == null) {
				throw new ArgumentNullException("left");
			}
			if (right == null) {
				throw new ArgumentNullException("right");
			}
			if (nodeType != SqlNodeType.EQ
				&& nodeType != SqlNodeType.NotEQ
				&& nodeType != SqlNodeType.GT
				&& nodeType != SqlNodeType.GE
				&& nodeType != SqlNodeType.LT
				&& nodeType != SqlNodeType.LE
				) {
				throw new ArgumentException("operation must be comparision operation");
			}
			_left = left;
			_right = right;
			_nodeType = nodeType;
		}
		public SqlExpression Left {
			get {
				return _left;
			}
		}
		public SqlExpression Right {
			get {
				return _right;
			}
		}
		public override SqlNodeType NodeType{
			get {
				return _nodeType;
			}
		}
		public override bool IsNotInjectionable {
			get {
				return false;
			}
		}
	}
}
